package juc;

import java.util.concurrent.TimeUnit;

/**
 * @author liwuji
 * @date 2024/1/19
 * @desc
 **/
public class LockSupportDemo {
    public static void main(String[] args) throws InterruptedException {
        Object o = new Object();
        new Thread(()->{
            synchronized (o){
                System.out.println(Thread.currentThread().getName()+" come in");
                try {
                    
                    o.wait();
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        },"t1").start();
        TimeUnit.SECONDS.sleep(1);
        new Thread(()->{
            synchronized (o){
                try {
                    o.notify();
                    System.out.println(Thread.currentThread().getName()+" 发出通知");
                    
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        },"t1").start();
    }
}
